/*淡入淡出 方法*/
function fun(domName, animateName) {
    /*若已经存在 class 不再执行逻辑*/
    let flag = true;
    for (let i = 0; i < domName.classList.length; i++) {
        if (domName.classList[i] === animateName) {
            flag = false;
        }
    }
    if (flag) {
        /*页面高度*/
        let pageHeight = window.outerHeight;
        /*DOM元素局顶部距离*/
        let domTop = domName.getBoundingClientRect().top || domName.offsetTop;
        /*滑动距离*/
        // let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        /*页面高度 + 滑动距离 > DOM元素局顶部距离时，元素进入页面*/
        if (pageHeight >= domTop) {
            domName.classList.add("myAnimated", `${animateName}`);
        }
    }
}

export default fun;
